<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="../../app/js/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../../app/css/footer.css" />
		<link rel="stylesheet" href="../../app/css/lystyle.css" />
		<link rel="stylesheet" type="text/css" href="../../app/css/backstage.css" />

		<style type="text/css">
			#wrap div#content {
				padding-top: 1.2rem;
			}
		</style>
		<script src="../../app/js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<input type="hidden" value="" id="auditStatusA1" />
		<input type="hidden" value="" id="merchantNameA1" />
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a href="backstage_index.html" id="headImg" href="#"><img class="headImg" src="../../app/images/12.png" /></a>
					<a href="person_applyCommercial.html" class="ly-headright">商家申请</a>
					<p id="headTitle">商户</p>
				</div>
				<div id="content">
					<div class="row" style="padding: 0.33rem;">
						<div class="col-xs-4">
							<select id="auditStatus" onchange="searcheryf(0)" class="form-control ly_select">
								<option value="">全部</option>
								<option value="-1">未通过</option>
								<option value="0">待审核</option>
								<option value="1">已通过</option>
							</select>
						</div>

						<div class="input-group col-xs-7">
							<a class="input-group-addon" id="basic-addon1" onclick="searcheryf(1)"><img style="width: 100%;" src="../../app/images/coalltion/search.png" /></a>
							<input id="merchantName" type="text" class="form-control modify" style="z-index: 0;" placeholder="商家名称" aria-describedby="basic-addon1">
						</div>
					</div>
					<div class="ly-info">
						<ul class="ly-info-ul">
							<!-- 商户信息 -->
						</ul>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script src="../../app/js/jquery-2.2.3.min.js"></script>
	<script type="text/javascript" src="../../app/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script src="../../app/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<style type="text/css">
		/*修改底部字体颜色*/
		
		.foot:nth-child(2) {
			color: #e83023;
		}
		
		.ly-listsub {
			clear: both;
			padding-top: 15px;
			line-height: 0px;
		}
		
		.search {
			width: 100%;
		}
		
		.input-group-addon {
			background: #FFF;
		}
		
		.input-group-addon {
			border-color: #e83023;
			border-bottom-left-radius: 18px;
			border-top-left-radius: 18px;
			-webkit-border-top-left-radius: 18px;
			-webkit-border-bottom-left-radius: 18px;
		}
		
		.modify {
			border-color: #e83023;
			border-left-width: 0px;
			border-bottom-right-radius: 18px;
			border-top-right-radius: 18px;
			-webkit-border-top-right-radius: 18px;
			-webkit-border-bottom-right-radius: 18px;
		}
	</style>
	<script type="text/javascript">
		var tokenReztApp = $.cookie("tokenReztApp");
		if(!tokenReztApp) {
			window.location.href = "../../app/view/login/login/login.html";
		}
		$(function() {
			currentyf();
		});

		//用户信息
		var user, role, goodsId;
		//获取当前会员信息
		function currentyf() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109/member-service/auth/current?token=" + tokenReztApp,
				dataType: "JSON",
				async: false,
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					$.removeCookie('tokenReztApp', {
						expires: 7,
						path: '/'
					});
					$.removeCookie("tokenRh", {
						expires: 7,
						path: '/'
					});
					$.removeCookie('memberId', {
						expires: 7,
						path: '/'
					});
					$.removeCookie('roleId', {
						expires: 7,
						path: '/'
					});
					window.location.href = "../../app/view/login/login/login.html";
				},
				success: function(data) {
					var check = true;
					for(var i = 0; i < data.roleList.length; i++) {
						var roles = data.roleList[i].id;
						var deadline = new Date(data.roleList[i].deadline);
						if(roles == "f2" && deadline >= new Date()) {
							check = false;
							role = roles; //角色
						}
					}
					if(check) {
						alert("权限不足，请升级为创客！");
						window.location.href = "../../app/view/login/login/login.html";
					}
					goodsId = data.id;
					user = data.loginName;
				}
			});
		}

		$(function() {
			sogoSearch(1, 999);
		});
		var pageNums, pageSizes;

		function sogoSearch(pageNum, pageSize) {
			pageNums = pageNum;
			pageSizes = pageSize;
			var urls = "http://47.104.13.109/applyfor-service/sogo/search?pageNum=" + pageNum + "&pageSize=" + pageSize + "&applyforUser=" + goodsId;
			var auditStatus = $("#auditStatusA1").val();
			var merchantName = $("#merchantNameA1").val();
			if(auditStatus != "" && auditStatus != null) {
				urls += "&auditStatus=" + auditStatus;
			}
			if(merchantName != "" && merchantName != null) {
				urls += "&merchantName=" + merchantName;
			}
			$.ajax({
				type: "GET",
				url: urls,
				dataType: "JSON",
				async: false,
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					layer.msg('删除失败，请联系系统管理员！');
				},
				success: function(data) {
					if(data.code == 0) {
						var html = "";
						$('.ly-info-ul').html(html);
						return;
					}
					var html = "";
					$('.ly-info-ul').html("");
					for(var i = 0; i < data.applyformsList.list.length; i++) {
						list = data.applyformsList.list[i];
						var auditStatus;
						switch(list.auditStatus) {
							case "-1":
								auditStatus = "未通过";
								break;
							case "0":
								auditStatus = "待审核";
								break;
							case "1":
								auditStatus = "已通过";
								break;
							default:
								auditStatus = "-";
								break;
						}
						html += '<li class="ly-info-li p33"><a href="backstage_storeinfo.html?id=' + list.id + '"><p class="ly-font14" style="line-height: 15px;"><span class="ly-bold">' + list.classifyOne + '</span><span style="float: right;color: #e83023;">' + auditStatus + '</span></p><p class="ly-font14 ly-listsub">' + list.merchantName + '</p></a></li>';
					}
					$('.ly-info-ul').html(html);
				}
			});
		}
		//筛选控制器
		function searcheryf(s) {
			if(s == 0) {
				$("#auditStatusA1").val($("#auditStatus").val());
				$("#merchantNameA1").val("");
				sogoSearch(1, 10);
			} else if(s == 1) {
				$("#auditStatusA1").val("");
				$("#merchantNameA1").val($("#merchantName").val());
				sogoSearch(1, 10);
			} else {

			}
		}
	</script>

</html>